package org.libl.web.servlet.student;

import org.libl.dao.student.StudentDao;
import org.libl.dao.student.impl.StudentDaoImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/student/edituser")
public class ExidUserController extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
        String sid = request.getParameter("sid");
        String sname = request.getParameter("sname");
        String age = request.getParameter("age");
        String email = request.getParameter("email");
        String telephone = request.getParameter("telephone");
        String addr = request.getParameter("addr");
        String sex = request.getParameter("sex");
        System.out.println(sname);
        StudentDao dao = new StudentDaoImpl();
        int b = dao.edit(sid,sname,age,email,telephone,addr,sex);
        System.out.println(b);
        response.setCharacterEncoding("utf-8");
        response.getWriter().write("成功");

//        request.setAttribute("pageBean",pageBean);
//        request.getRequestDispatcher("/student/page.jsp").forward(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
        doPost(request, response);
    }
}
